<template>
  <div class="container">
    <xy-table :api="api" :columns="columns">
      <template #addItem="">
        <el-button @click="addItem" size="mini" icon="el-icon-plus">
          {{ $language.local("添加") }}
        </el-button>
      </template>
      <template #view> <span></span></template>

      <template #check="{ row }">
        <el-button type="text" size="mini" @click="onDownload(row)">
          {{ $language.local("下载") }}
        </el-button>
      </template>
    </xy-table>
    <xy-form-dialog
      :visible.sync="formDialogVisible"
      :model="formData"
      :api="api"
      :title="dialogData.title"
    ></xy-form-dialog>
  </div>
</template>

<script>
import API from "../../plugins/api";
export default {
  data() {
    return {
      formDialogVisible: false,
      api: new API("/api/ContentTemplate/Create"),
      columns: {
        ServiceContent: "服务科目",
        InvoiceSubject: "发票科目",
        ModelTitle: "模板标题",
        ModelContent: "模板内容",
        RRContent: "灵工要求",
        ModelType: "模板类型",
        IsEnabled: "是否启用",
      },
      formData: {
        ServiceContent: "",
        InvoiceSubject: "",
        ModelTitle: "",
        ModelType: "",
        ModelContent: "",
        RRContent: "",
        IsEnabled: 0,
      },

      dialogData: {
        title: "",
      },
    };
  },
  methods: {
    addItem() {
      this.dialogData.title = "添加";
      this.formDialogVisible = true;
    },
  },
};
</script>

<style></style>
